package com.kltn.zique;

import android.os.Bundle;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

@SuppressLint("NewApi")
public class MainScreenActivity extends Activity {

	private Button btnCheckIn;
	private Button btnNearHere;
	private Button btnNewPost;
	private Button btnTopList;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main_screen);
		
		ActionBar actionBar = getActionBar();		
		actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#b51d21")));
		
		//actionBar.hide();
		
		/*ActionBar actionBar = getActionBar();
	    // add the custom view to the action bar
	    actionBar.setCustomView(R.layout.mainscreen);
	    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM
	        | ActionBar.DISPLAY_SHOW_HOME);*/
	    
		
		btnCheckIn = (Button) findViewById(R.id.btn_check_in);
		btnNearHere = (Button) findViewById(R.id.btn_near_here);
		btnNewPost = (Button) findViewById(R.id.btn_new_post);
		btnTopList = (Button) findViewById(R.id.btn_top_list);
		
		
		//Event click button Check in
		btnCheckIn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				 Intent i=new Intent(MainScreenActivity.this,NewPostScreenActivity.class);
			     startActivity(i);
			}
		});
		
		//Event click button Near here
		btnNearHere.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
			}
		});
		
		//Event click button New post
		btnNewPost.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
			}
		});
		
		//Event click button Top list
		btnTopList.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main_screen, menu);
		
		// Inflate the menu; this adds items to the action bar if it is present.
				getMenuInflater().inflate(R.menu.main_screen, menu);
				//getMenuInflater().inflate(R.menu.main_activity_actions, menu);
			    //MenuItem searchItem = menu.findItem(R.id.action_search);
			    //SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
				
				MenuItem btnSearch= menu.add(0,1,0,"Search");
				//MenuItem btnSearch =(MenuItem) menu.findItem(R.id.btn_search).getActionView();
				//btnSearch.setTitle("Search");
				btnSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
				btnSearch.setIcon(R.drawable.btn_icon_search);

			    MenuItem btnProfile= menu.add(0,2,0,"Profile");
			    btnProfile.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
			    btnProfile.setIcon(R.drawable.btn_icon_profile);
		
		return true;
	}

}
